package org.jeecg.common.system.base.entity;

import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.constant.CommonConstant;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description: Entity基类
 * @Author: dangzhenghui@163.com
 * @Date: 2019-4-28
 * @Version: 1.1
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class BaseEntity extends IdBaseEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	/** 创建人 */
	@ApiModelProperty(value = "创建人")
//	@Excel(name = "创建人", width = 15)
	private String createBy;

	/** 创建时间 */
	@ApiModelProperty(value = "创建时间")
//	@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;

	/** 更新人 */
	@ApiModelProperty(value = "更新人")
//	@Excel(name = "更新人", width = 15)
	private String updateBy;
	
	/** 更新时间 */
	@ApiModelProperty(value = "更新时间")
//	@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date updateTime;

	/**备注*/
	@Excel(name = "备注", width = 15)
	@ApiModelProperty(value = "备注")
	private String remark;

	/**所属部门*/
//    @Excel(name = "所属部门CODE", width = 15)
	@ApiModelProperty(value = "所属部门CODE", hidden = true)
	@JsonIgnore
	private String sysOrgCode;

	/**所属公司*/
    @Excel(name = "所属公司", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id", dicKey ="parent_id='" + CommonConstant.BASE_DEPART_ID + "'")
	@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
	@ApiModelProperty(value = "所属公司", hidden = true)
	private String companyId;
	/**
	 * 版本号 int(11)
	 */
//	@JsonIgnore
	@Version // 逻辑删除字段
	@ApiModelProperty(hidden = true)
	private Integer versionFlag;
}
